function getOrigin(){
    let _origin = '';
    if(process.env.NODE_ENV === 'development'){
        // 本地启动服务
        _origin = 'deepcoin.com';
    }else{
        // 打包
        let hostArr = window.location.host.split('.')
        _origin = hostArr.length === 3 ? hostArr[1] + '.' + hostArr[2] : hostArr[0] + '.' + hostArr[1]
    }
    return _origin
}

let origin = getOrigin();
let supportOrigin = window.location.origin;

const apiJSON = {
    uat : {
        wapi: 'https://uat-wapi.goodtest.cc/',
        trade: 'https:///uat-api.goodtest.cc/',
        partnerUrl: 'https://uat-agent.goodtest.cc/',
        help: supportOrigin + '/',
        helpOld: 'https://support.deepcoin.online/',
        headUrl: 'https://n-bkt.deepcoin.ski/',
        h5Url: 'https://uat-h5.goodtest.cc/',
        scanLogin: 'wss://uat-mwss.goodtest.cc/',
        spotPublicWs: 'wss://uat-wss.goodtest.cc/public/spotws',
        spotPrivateWs: 'wss://uat-wss.goodtest.cc/private/spotws',
        swapPublicWs: 'wss://uat-wss.goodtest.cc/public/ws',
        swapPrivateWs: 'wss://uat-wss.goodtest.cc/private/ws',
        redpacketWs: 'wss://uat-redws.deepcoin.pro/redpkg',
        mapi: 'https://uat-mapi.goodtest.cc/',
        liveWs: 'wss://uat-wapi.goodtest.cc/dcLive/ws',
        game: 'https://uat-game.goodtest.cc/',
        gameWs: 'wss://uat-for-wss.deepcoin.me/ws',
        appUrl: 'https://uat-h5app.goodtest.cc/',
        awsUrlPublic: 'https://test-static-publice.goodtest.cc/',
        awsUrlPrivate: 'https://test-static-private.goodtest.cc//',
        sensorsUrl: 'https://ubt.deepcoin.pro/sa?project=default',
    },
    test : {
        wapi: 'https://test-wapi.goodtest.cc/',
        trade: 'https:///test-api.goodtest.cc/',
        partnerUrl: 'https://test-agent.goodtest.cc/',
        help: supportOrigin + '/',
        helpOld: 'https://support.deepcoin.online/',
        headUrl: 'https://n-bkt.deepcoin.ski/',
        h5Url: 'https://test-h5.goodtest.cc/',
        scanLogin: 'wss://test-mwss.goodtest.cc/',
        spotPublicWs: 'wss://test-wss.goodtest.cc/public/spotws',
        spotPrivateWs: 'wss://test-wss.goodtest.cc/private/spotws',
        swapPublicWs: 'wss://test-wss.goodtest.cc/public/ws',
        swapPrivateWs: 'wss://test-wss.goodtest.cc/private/ws',
        redpacketWs: 'wss://dev-redws.deepcoin.pro/redpkg',
        mapi: 'https://test-mapi.goodtest.cc/',
        liveWs: 'wss://test-wapi.goodtest.cc/dcLive/ws',
        game: 'https://test-game.goodtest.cc/',
        gameWs: 'wss://test-wss.goodtest.cc/business/ws',
        appUrl: 'https://test-h5app.goodtest.cc/',
        awsUrlPublic: 'https://test-static-publice.goodtest.cc/',
        awsUrlPrivate: 'https://test-static-private.goodtest.cc/',
        sensorsUrl: 'https://ubt.deepcoin.pro/sa?project=default',
    },
    pre : {
        wapi: 'https://f01-wapi.qianjiaoliren.top/',
        trade: 'https://f01-api.qianjiaoliren.top/',
        partnerUrl: 'https://f01-agent.qianjiaoliren.top/',
        help: supportOrigin + '/',
        helpOld: 'https://support.deepcoin.online/',
        headUrl: 'https://n-bkt.deepcoin.ski/',
        h5Url: 'https://f01-h5.goodtest.cc/',
        scanLogin: 'wss://f01-mwss.qianjiaoliren.top/',
        spotPublicWs: 'wss://f01-wss.qianjiaoliren.top/public/spotws',
        spotPrivateWs: 'wss://f01-wss.qianjiaoliren.top/private/spotws',
        swapPublicWs: 'wss://f01-wss.qianjiaoliren.top/public/ws',
        swapPrivateWs: 'wss://f01-wss.qianjiaoliren.top/private/ws',
        redpacketWs: 'wss://pre-redws.deepcoin.pro/redpkg',
        liveWs: 'wss://f01-wapi.qianjiaoliren.top/dcLive/ws',
        mapi: 'https://f01-mapi.qianjiaoliren.top/',
        game: 'https://f01-game.qianjiaoliren.top/',
        gameWs: 'wss://f01-wss.qianjiaoliren.top/business/ws',
        appUrl: 'https://f01-h5app.goodtest.cc/',
        awsUrlPublic: 'https://test-static-publice.goodtest.cc/',
        awsUrlPrivate: 'https://test-static-private.goodtest.cc/',
        sensorsUrl: 'https://ubt.deepcoin.pro/sa?project=default',
    },
    sit : {
        wapi: 'https://sit-wapi.goodtest.cc/',
        trade: 'https://sit-api.goodtest.cc/',
        partnerUrl: 'https://sit-agent.goodtest.cc/',
        help: supportOrigin + '/',
        helpOld: 'https://support.deepcoin.online/',
        headUrl: 'https://n-bkt.deepcoin.ski/',
        h5Url: 'https://sit-h5.goodtest.cc/',
        scanLogin: 'wss://sit-mwss.goodtest.cc/',
        spotPublicWs: 'wss://sit-wss.goodtest.cc/public/spotws',
        spotPrivateWs: 'wss://sit-wss.goodtest.cc/private/spotws',
        swapPublicWs: 'wss://sit-wss.goodtest.cc/public/ws',
        swapPrivateWs: 'wss://sit-wss.goodtest.cc/private/ws',
        redpacketWs: 'wss://sit-redws.deepcoin.pro/redpkg',
        liveWs: 'wss://sit-wapi.goodtest.cc/dcLive/ws',
        mapi: 'https://sit-mapi.goodtest.cc/',
        game: 'https://sit-game.goodtest.cc/',
        gameWs: 'wss://sit-wss.goodtest.cc/business/ws',
        appUrl: 'https://sit-h5app.goodtest.cc/',
        awsUrlPublic: 'https://test-static-publice.goodtest.cc/',
        awsUrlPrivate: 'https://test-static-private.goodtest.cc/',
        sensorsUrl: 'https://ubt.deepcoin.pro/sa?project=production',
    },
    production : {
        wapi: 'https://net-wapi.' + origin + '/',
        trade: 'https://www.' + origin + '/',
        partnerUrl: 'https://net-agent.' + origin + '/',
        help: supportOrigin + '/',
        helpOld: 'https://support.deepcoin.online/',
        headUrl: 'https://n-bkt.deepcoin.ski/',
        h5Url: 'https://net-h5.deepcoin.online/',
        scanLogin: 'wss://net-wapi.' + origin + '/',
        spotPublicWs: 'wss://net-wss.' + origin + '/public/spotws',
        spotPrivateWs: 'wss://net-wss.' + origin + '/private/spotws',
        swapPublicWs: 'wss://net-wss.' + origin + '/public/ws',
        swapPrivateWs: 'wss://net-wss.' + origin + '/private/ws',
        redpacketWs: 'wss://net-redws.deepcoin.pro/redpkg',
        liveWs: 'wss://net-wapi.' + origin + '/dcLive/ws',
        mapi: 'https://net-mapi.' + origin + '/',
        game: 'https://net-game.' + origin + '/',
        gameWs: 'wss://net-wss.' + origin + '/business/ws',
        appUrl: 'https://www.deepcoin.online/',
        awsUrlPublic: 'https://net-static-public.deepcoin.cool/',
        awsUrlPrivate: 'https://net-static-private.deepcoin.cool/',
        sensorsUrl: 'https://ubt.deepcoin.pro/sa?project=production',
    }
}

const env = process.env.REACT_APP_DOT_ENV || 'production';
export const apiUrl = apiJSON[env];
